#ifndef PHYSIC2DWORLD_H
#define PHYSIC2DWORLD_H

#include <QPointF>
#include <QMap>
#include "bodies/BasicBody.h"
#include "Collision.h"
#include "ConvexHull.h"


class Physic2DWorld {
public:
	Physic2DWorld(QPointF* gravity);
	~Physic2DWorld();
	void addBody(Body* body);
	void update(float interval);
	void updateBody(Body* body);
	ConvexHull* createMovedShape(Body* body, AABB startAABB);
	bool checkCollision(Body* body);
	void collisionCheckOtherAll(Body* body, CollisionInfo* collisionInfo);
	void dellCollisionResponse(QSet<CollisionInfo*>* collisionInfos);

	void applyAllForce(Body* body);
	Body* applyGravity(Body* body);
private:
	QPointF* gravity;
	QMap<int, Body*>* bodies;
	Collision* collision;
	float interval;
	int thisPoint = 0;
};

#endif PHYSIC2DWORLD_H
